<?php
namespace Home\Controller;

use Think\Controller;

/**
 * CommonController
 * 通用控制器
 */
class CommonController extends Controller {

    /**
    * 全局初始化
    * @return
    */
    public function _initialize() {
        // utf-8编码
        header('Content-Type: application/json; charset=utf-8');
    }

    /**
     * 空操作
     * @return
     */
    public function _empty() {
        return json_encode(array('error' => 404));
    }

    public function buildResult($status, $msg, $data) {
        return array(
            'status' => $status,
            'msg' => $msg,
            'data' => $data
        );
    }
}
